{% extends 'pc/person/indexOthers.html' %}
{% load static %}

{% block end %}
    <div class="person fl">

        <div class="clearfix">
            <div class="fl left_nav">
                <ul id="info">
                    <li data-type="" class="active"><a href="javascript:;">个人资料</a></li>
                </ul>
            </div>
            <article class="fr">
                 <div class="blogs">
                     <div class="blogs_head" style="background: url({% static 'img/recommend.png' %})no-repeat 0 50%;">
                         <span>个人资料</span>
                     </div>
                     <div class="follow_main">
                         <div class="info_item clearfix"style="position: relative">
                             <label for="name">头像</label>
                             <a class="imgbox">
                                 <span id="img3" class="info_img" style="background-image:url({% if user.user_imag  %}
                                 {{ MEDIA_URL }}{{user.user_imag }}
                                     {% elif user.user_image%}
                                     {{user.user_image }}
                                     {% else %}
                                     {% static 'img/pc-icon.png' %}
                                 {% endif %});"></span>
                              </a>
                         </div>
                         <div class="info_item clearfix">
                             <label for="name">用户名</label>
                             <input type="text" name="username"class="val origin" value="{{ user.username }}" disabled>
                         </div>
                         <div class="info_item clearfix">
                             <label for="name">职位</label>
                                 <input type="text" name="position"class="val origin" value="{{ user.position }}"disabled>
                             </div>
                         <div class="info_item clearfix">
                             <label for="name" style="left:-7px;position: relative;">个人介绍 </label>
                             <textarea name="info" id="me" class="val origin"  disabled>{{ user.info }}</textarea>
                             </div>

                     </div>
                 </div>
            </article>
        </div>
    </div>

{% endblock %}
{% block js %}
     <script src="{% static 'js/promise.min.js' %}"></script>
    <script src="{% static 'js/sweetalert.min.js' %}"></script>
    <script>
     function flollw (obj){
          $.ajax({
                url:'/person/author/',
                type:'post',
                data:{follow:obj,'username':'{{ request.user.id }}'},
                  headers:{'X-CSRFToken':$.cookie('csrftoken')},
                success:function (data) {
                        if(data.status==403){
                       swal({
                          text: data.message,
                          icon: "error",
                        }).then(function () {
                           window.location.href = "{% url 'index' %}?next={{ request.path }}"
                       })
                    }else{
                    swal({
                          text: data.message,
                          icon: "success",
                        }).then(function () {
                            window.location.reload()
                        })
                     }
                },
                error:function (xhr) {
                    console.log(xhr)
                }
            })
    }
    </script>
{% endblock %}